package zwp.exercise.demo_exercise.controller.database_test;

import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zwp.exercise.demo_exercise.pojo.domain.HolidayDomain;
import zwp.exercise.demo_exercise.service.impl.MySqlTestServiceImpl;

import java.util.List;

/**
 * @Author zwp14
 * @create 2024/6/10 20:32
 * @description 数据库连接测试
 */

@RestController
@RequiredArgsConstructor
@RequestMapping("/dataConnect")
@Api(tags = "数据库连接测试")
public class MySqlTestController {
    private final MySqlTestServiceImpl mySqlTestService;

    /**
     * sql查询结果
     *
     * @return 数据结果
     */
    @GetMapping("/test1")
    public String connectTest1() {
        return mySqlTestService.connectTest1()+"jre插件安装成功测试!";
    }

    /**
     * mybatis-plus 查询
     *
     * @return 数据结果
     */
    @GetMapping("/test2")
    public List<HolidayDomain> connectTest2() {
        return mySqlTestService.connectTest2();
    }
}
